package org.osite.util;

public class IntArray {
    private int buffer[] = new int[16];
    private int length = 0;
    
    public void put(int value) {
        if (length == buffer.length) {
            int temp[] = new int[length + length];
            System.arraycopy(buffer, 0, temp, 0, length);
            buffer = temp;
        }
        buffer[length++] = value;
    }
    
    public int[] toArray() {
        int result[] = new int[length];
        System.arraycopy(buffer, 0, result, 0, length);
        return result;
    }    
}
